﻿Imports System.Data.OleDb
Public Class ViewProfile
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not IsPostBack Then
            Dim oleDbConn As New OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("CoinsConn").ConnectionString)
            Dim SqlString As String = "SELECT * FROM Profiles WHERE Use_Name=@f1"
            Dim cmd As OleDbCommand = New OleDbCommand(SqlString, oleDbConn)
            cmd.CommandType = CommandType.Text
            cmd.Parameters.AddWithValue("@f1", User.Identity.Name)
            oleDbConn.Open()
            Dim dr As OleDbDataReader = cmd.ExecuteReader()
            If dr.HasRows Then
                dr.Read()
                If Not IsDBNull(dr("Use_Pic")) Then Img_Profile.ImageUrl = dr("Use_Pic")
                If Not IsDBNull(dr("First_Name")) Then lb_firstname.Text = dr("First_Name").ToString()
                If Not IsDBNull(dr("Last_Name")) Then lb_lastname.Text = dr("Last_Name").ToString()
                If Not IsDBNull(dr("U_DOB")) Then lb_dob.Text = dr("U_DOB").ToString()
                If Not IsDBNull(dr("Use_Gender")) Then lb_gender.Text = dr("Use_Gender").ToString()
                If Not IsDBNull(dr("Use_Desc")) Then lb_desc.Text = dr("Use_Desc").ToString()
                If Not IsDBNull(dr("Use_Email")) Then lb_email.Text = dr("Use_Email").ToString()
            End If
        End If
    End Sub

    Protected Sub btn_editprofile_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btn_editprofile.Click
        Response.Redirect("UserProfile.aspx")
    End Sub
End Class